<%--
  Created by IntelliJ IDEA.
  User: gg
  Date: 14-4-23
  Time: 下午3:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
    <link rel="stylesheet" href="${ctx}/resources/plugin/datepicker/css/base/jquery-ui.css" />
    <link rel="stylesheet" href="${ctx}/css/common.css" />
</head>
<body>
<div class="row">
    <div class="col-md-12">
        <div class="page-header">
            <h1>
                Form Elements
                <small>
                    <i class="icon-double-angle-right"></i>
                    Common form elements and layouts
                </small>
            </h1>
        </div>
        <!-- /.page-header -->
        <form class="form-horizontal validation-form" action="" method="post">
             <input type="hidden" name="id" value="${pRole.id}"/>
            <div class="row">
                <div class="col-md-12">
                    <div class="form-group">
                        <label class="col-md-3 control-label no-padding-right" for="name"> 角色名称 </label>
                        <div class="col-md-9">
                            <input type="text" id="name" name="name" class="col-md-5 required" value="${pRole.name}"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="clearfix form-actions">
                <div class="col-md-offset-9 col-md-3">
                    <button class="btn btn-info submit_button" type="button">
                        <i class="icon-ok bigger-110"></i>
                        提交
                    </button>
                    &nbsp; &nbsp; &nbsp;
                    <button class="btn" type="reset">
                        <i class="icon-undo bigger-110"></i>
                        重置
                    </button>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $('.validation-form').validate({});
    })
    $('body').on('click', '.submit_button', function (e) {
        //保存表单
        var formObj = $(this).parents('form');
        if (!formObj.valid()) return false;
        $.simpleAjax({url: '${ctx}/pRole/save.do', data: formObj.serialize(), callback: function (data) {
            $.initAlert({message: data.message,callback:function(){
                window.location.href='${ctx}/pRole/index.do';
            }});
        }});
        return false;
        e.stopPropagation();
    })
</script>
</body>
</html>